package homework.oo5.test01;

public class StaticDemo {
    public static void main(String[] args) {
        StaticVar s1 = new StaticVar();
        s1.show();//a=1,b=1

        StaticVar s2 = new StaticVar();
        s2.show();//a=1,b=2

        StaticVar s3 = new StaticVar();
        s3.show();//a=1,b=3

        //StaticVar.class文件先加载到方法区
        //静态变量b也加载到方法区，且只有一份
        //所以每次都是在方法区中的b中++,

        System.out.println(StaticVar.NUM);
        System.out.println(StaticVar.c);
        //StaticVar.NUM = 3.151819; 常量不能改变
    }
}
